/**
 * Copyright (c) 2017-2022 Rushang Co.Ltd All Rights Reserved.
 */
package com.rshang.rsdp.controller;

import com.rshang.rsdp.bean.DataGrid;
import com.rshang.rsdp.bean.Response;
import com.rshang.rsdp.service.IDmRsdlGsaService;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * 功能简介：公司数据处理api<br/>
 *
 * @author zhangjun
 * @create 2017年8月20日上午11:45:29
 */
@Controller
@RequiresRoles("管理员")
@RequestMapping("/system/gs")
public class GsController extends BaseController {

    @Autowired
    IDmRsdlGsaService service;

    @ResponseBody
    @RequestMapping("/manage")
    public DataGrid manage(HttpServletRequest request) {
        return service.getGsPageList(getPage(), request);
    }

    @RequestMapping("/addSave")
    @ResponseBody
    public Response addSave() {
        return service.addSave(request, this.getSessionUser().getUserId());
    }

    @RequestMapping("/editSave")
    @ResponseBody
    public Response aditSave() {
        return service.editSave(request, this.getSessionUser().getUserId());
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Response delete() {
        return service.deleteSave(request, this.getSessionUser().getUserId());
    }

    @RequestMapping("/checkGsmc")
    @ResponseBody
    public Response checkGsmc() {
        return service.checkGsmc(request);
    }
}
